package livesun.justiceeternal.fragment;

import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
import android.widget.TextView;

import com.zzhoujay.richtext.RichText;

import br.tiagohm.markdownview.MarkdownView;
import br.tiagohm.markdownview.css.styles.Github;
import livesun.justiceeternal.R;
import livesun.justiceeternal.base.BaseFragment;
import livesun.justiceeternal.utils.HandlerFactory;

/**
 * 类描述：简介
 * 创建人：livesun
 * 创建时间：2018/1/3.
 * 修改人：
 * 修改时间：
 * github：https://github.com/livesun
 */
public class DescriptionFragment extends BaseFragment {

    private MarkdownView mMarkdownView;
    private SwipeRefreshLayout swip;

    @Override
    public int getResourcesId() {
        return R.layout.fragment_description;
    }

    @Override
    public void initView() {
        mMarkdownView = findView(R.id.markdown_view);
        swip = findView(R.id.swip);
        swip.setColorSchemeResources(R.color.colorAccent);
        swip.setOnRefreshListener(() -> {
            HandlerFactory.main().postDelayed(() -> swip.setRefreshing(false),300);
            mMarkdownView.loadMarkdownFromUrl("https://raw.githubusercontent.com/zytx121/je/master/README.md");
        });
        mMarkdownView.addStyleSheet(new Github());
        mMarkdownView.setEmojiImageExtension("svg");
        mMarkdownView.loadMarkdownFromUrl("https://raw.githubusercontent.com/zytx121/je/master/README.md");
    }

    @Override
    public void initListener() {

    }

    @Override
    public void onClick(View v, int id) {

    }

}
